// test-reconciliation-report.js
// 测试对账报告功能

const http = require('http');

// 测试获取对账报告数据
function testGetReconciliationReportData() {
  const options = {
    hostname: 'localhost',
    port: 9001,
    path: '/api/v1/reconciliation/report-data?startDate=2023-01-01&endDate=2023-12-31',
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    }
  };

  const req = http.request(options, (res) => {
    let data = '';
    
    res.on('data', (chunk) => {
      data += chunk;
    });
    
    res.on('end', () => {
      console.log('获取对账报告数据响应:');
      console.log('状态码:', res.statusCode);
      console.log('响应数据:', data);
      
      try {
        const jsonData = JSON.parse(data);
        console.log('解析后的数据:', JSON.stringify(jsonData, null, 2));
      } catch (e) {
        console.error('解析响应数据失败:', e);
      }
    });
  });

  req.on('error', (error) => {
    console.error('请求失败:', error);
  });

  req.end();
}

// 执行测试
console.log('开始测试对账报告功能...\n');

console.log('1. 测试获取对账报告数据:');
testGetReconciliationReportData();